Core Printing Features
Generally, you work with printing-related objects when a user creates, saves, closes, or opens a printable document. A job object represents the primary association between a document, which is application-defined, and QuickDraw GX printing features. The job object represents a print job in the sense that it specifies the parameters for printing a document. Thus, core printing features require you to manipulate the job object. Figure 1-15 shows how you manipulate the job object in response to user actions.Figure 1-15 Manipulating the job object in response to user actions
When you create a job object, QuickDraw GX automatically provides you with default format and paper-type objects. The initial values of these objects are determined by the output printer that is currently selected when the job is created. These values can change if the user later changes the output printer.
You associate your document's data with the job object. QuickDraw GX maintains the relationship between the job, format, paper-type objects, and their collections. This is useful when you save or open a document because these objects must be flattened or unflattened, respectively.
Flattening and unflattening QuickDraw GX printing-related objects is very similar to flattening and unflattening a shape object. When you flatten a shape object, the style, ink, and transform objects are flattened with it. For printing-related objects, QuickDraw GX flattens all related objects with the job object, including multiple format, paper-type, and collection objects. They may be flattened in the form of a handle, which is convenient for writing the objects to the resource fork, or you can use your own procedure to store the job object and related objects wherever you wish.
You are responsible for displaying the Print and Page Setup dialog boxes. Because these dialog boxes are movable, your application must install a handler for the
gxPrintingEvent
message to update the screen if a dialog box moves.Actual printing, which from the application's perspective means spooling the document to the printer driver, involves looping through the pages to be printed, and perhaps looping through the shapes to be included on each page. The work of applying formatting instructions and such is the responsibility of the printer driver.
There are several other things you must do to implement core printing features:
None of these tasks are conceptually difficult. The chapter "Core Printing Features" in this book shows you how to perform each of these tasks.
- Identify the location of the Edit menu and its items to allow QuickDraw GX to support the Cut, Copy, and Paste menu items when a print dialog box is active.
- Support printing from the Finder, which requires that your application support the Print Documents ('
pdoc
') Apple event and support this Apple event's optional attribute to allow the user to drag a copy of the document to a desktop printer for printing.- Allow users to print documents originally created to print with the Macintosh Printing Manager.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help